CREATE TABLE [dbo].[tb_TiposOrganizacion]
(
[idTipoOrganizacion] [int] NOT NULL IDENTITY(1, 1),
[Descripcion] [varchar] (25) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL
) ON [PRIMARY]
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO
CREATE TRIGGER [dbo].[updatetb_TiposOrganizacion] ON [dbo].[tb_TiposOrganizacion]
 FOR UPDATE AS 
 IF (update(idTipoOrganizacion)) begin 
	 SELECT * FROM inserted 
	 IF @@ROWCOUNT = 1 begin 
		 UPDATE tb_Organizaciones
		 SET Tipo = (SELECT idTipoOrganizacion FROM inserted)
		 WHERE tb_Organizaciones.Tipo = (SELECT idTipoOrganizacion FROM deleted)
	end  ELSE begin 
		 ROLLBACK TRANSACTION 
 end 
 end
GO
ALTER TABLE [dbo].[tb_TiposOrganizacion] ADD CONSTRAINT [PK_tb_TiposOrganizacion] PRIMARY KEY NONCLUSTERED  ([idTipoOrganizacion]) ON [PRIMARY]
GO
